<div class="content-section implementation GridDemo clearfixes">
  <form class="form-horizontal storage" [formGroup]="shelfForm"   >
    <p-panel >
      <p-header>
        <div class="ui-helper-clearfix">
          <span class="ui-panel-title" style="font-size:16px;display:inline-block;margin-top:2px"></span>
          <button class="save"  pButton type="button"  label="返回" (click)="goBack()"  > </button>
          <button class="save"  pButton type="submit" [ngStyle]="{'float':'right'}" label="提交" (click)="formSubmit()"   ></button>
          <button class="save" pButton type="submit" [ngStyle]="{'float':'right'}" (click)="formSave()" label="保存"  ></button>
        </div>
      </p-header>
      <div class="ui-grid ui-grid-responsive ui-grid-pad ui-fluid" style="margin: 10px 0px">

        <div class="ui-g margin-bottom-1vw">
          <div class="ui-g-6 ui-md-2 ui-lg-1 ui-padding-10px text-right">
            <label >上架单号:</label>
          </div>
          <div class="ui-g-6 ui-md-6 ui-lg-4">
            <input  formControlName="sid"  name="sid"   type="text" pInputText   placeholder="系统自动获取"  readonly [(ngModel)]="detailData.sid">
          </div>
          <div class="ui-g-6 ui-md-6 ui-lg-3 text-right">
            <label >状态:</label>
          </div>
          <div class="ui-g-6 ui-md-6 ui-lg-4">
            <p-dropdown formControlName="status"  [options]="statusNames" [autoWidth]="false" name="cycle"    readonly="true" [(ngModel)]="detailData.status"></p-dropdown>
          </div>
        </div>
        <div class="ui-g margin-bottom-1vw">
          <div class="ui-g-6 ui-md-2 ui-lg-1 text-right">
            <label >申请人:</label>
          </div>
          <div class="ui-g-6 ui-md-6 ui-lg-2">
            <input formControlName="creator"  type="text" pInputText  name="creator" placeholder="申请人"
                   readonly class="cursor_not_allowed"  [(ngModel)]="detailData.applicant" />
            <div class="ui-message ui-messages-error ui-corner-all "   *ngIf="!shelfForm.controls['creator'].valid&&(!shelfForm.controls['creator'].untouched)" >
              <i class="fa fa-close"></i>
              申请人必填
            </div>
          </div>
          <div class="ui-g-6 ui-md-6 ui-lg-1">
            <button pButton  type="button" (click)="showPersonMask()" label="选择" ></button>
          </div>
          <div class="ui-g-6 ui-md-6 ui-lg-1">
            <button pButton  (click)="clearTreeDialog()" label="清空" ></button>
          </div>
          <div class="ui-g-6 ui-md-6 ui-lg-3 text-right">
            <label >申请人组织:</label>
          </div>
          <div class="ui-g-6 ui-md-6 ui-lg-4">
            <input formControlName="creator_org" pInputText type="text"  name="startTime" [(ngModel)]="detailData.applicant_org"  readonly   class="no-border"/>
          </div>
        </div>

        <div class="ui-g margin-bottom-1vw">
          <div class="ui-g-6 ui-md-6 ui-lg-1 ui-padding-10px text-right">
            <label >上架类型:</label>
          </div>
          <div class="ui-g-6 ui-md-6 ui-lg-4">
            <p-dropdown [autoWidth]="false" formControlName="assetshelve_type" [options]="assetshelve_type"  name="fenlei" [(ngModel)]="detailData.assetshelve_type" ></p-dropdown>
          </div>
          <div class="ui-g-6 ui-md-6 ui-lg-3 text-right">
            <label >部门审批人:</label>
          </div>

          <div class="ui-g-6 ui-md-6 ui-lg-4">
            <p-dropdown [autoWidth]="false" formControlName="org_approver" [options]="updatedropDownData"  name="fenlei" [(ngModel)]="detailData.approve" ></p-dropdown>
         <!--{{detailData.approve}}-->
          </div>

        </div>

        <div class="ui-g margin-bottom-1vw" formGroupName="timeGroup">
          <div class="ui-g-6 ui-md-6 ui-lg-1 text-right">
            <label ><span>*</span>计划上架时间:</label>
          </div>
          <div class="ui-g-6 ui-md-6 ui-lg-4">
            <p-calendar
              formControlName="startTime"
              [showIcon]="true"
              [locale]="zh"
              [styleClass]="'schedule-add'"
              dateFormat="yy-mm-dd"
              [required]="true"
              dataType="string"
              [minDate]="nowDate"
              [showTime]="true"
              [showSeconds]="true"

              [(ngModel)]="detailData.assetshelve_plantime_begin" >
            </p-calendar>
            <div [hidden]="shelfForm.get(['timeGroup','startTime']).valid||shelfForm.get(['timeGroup','startTime']).untouched">
              <div class="ui-message ui-messages-error ui-corner-all"  [hidden]="!shelfForm.hasError('required',['timeGroup','startTime'])">
                <i class="fa fa-close"></i>
                计划上架时间必填
              </div>
            </div>
          </div>
          <div class="ui-g-6 ui-md-6 ui-lg-3 text-right ">
            <label ><span>*</span>计划完成时间:</label>
          </div>
          <div class="ui-g-6 ui-md-6 ui-lg-4">
            <p-calendar
              formControlName="endTime"
              [showIcon]="true" [locale]="zh" name="return_time"
              [styleClass]="'schedule-add'" dateFormat="yy-mm-dd" [required]="true" dataType="string"
              [minDate]="nowDate" [(ngModel)]="detailData.assetshelve_plantime_end"  [showTime]="true"
              [showSeconds]="true"
            >
            </p-calendar>
            <div [hidden]="shelfForm.get(['timeGroup','endTime']).valid||shelfForm.get(['timeGroup','endTime']).untouched">
              <div class="ui-message ui-messages-error ui-corner-all"  [hidden]="!shelfForm.hasError('required',['timeGroup','endTime'])" >
                <i class="fa fa-close"></i>
                计划完成时间必填
              </div>
            </div>
            <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="shelfForm.hasError('time','timeGroup')" >
              <i class="fa fa-close"></i>
              {{shelfForm.getError('time','timeGroup')?.descxxx}}
            </div>
          </div>
        </div>
        <div class="ui-g margin-bottom-1vw">
          <div class="ui-g-6 ui-md-6 ui-lg-1 ui-padding-10px text-right">
            <label >预计使用周期:</label>
          </div>
          <div class="ui-g-6 ui-md-6 ui-lg-4">
            <input  formControlName="usage_time"  name="usage_time"   type="text" pInputText   placeholder="预计使用周期" [(ngModel)]="detailData.usage_time"  >
          </div>
          <div class="ui-g-6 ui-md-6 ui-lg-3 text-right">
            <label ><span></span>计划上架区域:</label>
          </div>
          <div class="ui-g-6 ui-md-6 ui-lg-2">
            <input formControlName="assetshelve_location"  type="text" pInputText  name="inspectiondepartments" placeholder="计划上架区域"
                   readonly class="cursor_not_allowed"  [(ngModel)]="detailData.assetshelve_location" />
            <div class="ui-message ui-messages-error ui-corner-all "   *ngIf="!shelfForm.controls['assetshelve_location'].valid&&(!shelfForm.controls['assetshelve_location'].untouched)" >
              <i class="fa fa-close"></i>
              计划上架区域必填
            </div>
          </div>
          <div class="ui-g-6 ui-md-6 ui-lg-1">
            <button pButton  type="button" (click)="showLocationMask()" label="选择" ></button>
          </div>
          <div class="ui-g-6 ui-md-6 ui-lg-1">
            <button pButton  (click)="clearLocationDialog()" label="清空" ></button>
          </div>
        </div>
        <div class="ui-g margin-bottom-1vw">
          <div class="ui-g-6 ui-md-6 ui-lg-1 text-right">
            <label ><span>*</span>关联预占单号:</label>
          </div>
          <div class="ui-g-6 ui-md-6 ui-lg-4">
            <input formControlName="preoccupied_sid"  type="text" pInputText  name="inspectiondepartments" placeholder="关联预占单号"
                   readonly class="cursor_not_allowed"  [(ngModel)]="detailData.preoccupied_sid" />
            <!--<div class="ui-message ui-messages-error ui-corner-all "   *ngIf="!shelfForm.controls['preoccupied_sid'].valid&&(!shelfForm.controls['preoccupied_sid'].untouched)" >-->
              <!--<i class="fa fa-close"></i>-->
              <!--关联预占单号必填-->
            <!--</div>-->
          </div>
          <!--<div class="ui-g-6 ui-md-6 ui-lg-1">-->
            <!--<button pButton  type="button"  label="选择" ></button>-->
          <!--</div>-->
          <!--<div class="ui-g-6 ui-md-6 ui-lg-1">-->
            <!--<button pButton  (click)="clearTreeDialog()" label="清空" ></button>-->
          <!--</div>-->
          <div class="ui-g-6 ui-md-6 ui-lg-3 ui-padding-10px text-right">
            <label >供应电级:</label>
          </div>
          <div class="ui-g-6 ui-md-6 ui-lg-4">
            <ng-container *ngFor="let radio of radioButton">
              <p-radioButton formControlName="power_level" name="group" value="{{radio.value}}" label="{{radio.label}}"  [(ngModel)]="detailData.power_level"></p-radioButton>
            </ng-container>
          </div>
        </div>
        <div class="ui-g margin-bottom-1vw">
          <div class="ui-g-6 ui-md-6 ui-lg-1 text-right">
            <label ><span></span>上架原因:</label>
          </div>
          <div class="ui-g-6 ui-md-6 ui-lg-11">
            <textarea formControlName="assetshelve_reason" name="jianshu" pInputTextarea type="text" [(ngModel)]="detailData.assetshelve_reason" ></textarea>
          </div>
        </div>
      </div>
    </p-panel>
    <div class="ui-grid-row margin-bottom-1vw">
      <div class="ui-grid-col-2">
      </div>
    </div>
    <label></label>
    <div class="" >
      <div class="ui-g">
        <div class="ui-g-6 ui-md-6 ui-lg-8 text-right" ></div>
        <div class="ui-g-6 ui-md-6 ui-lg-4 text-right" >
          <button class="save"  pButton   (click)="deleteStorage()" label="移除" [disabled]="selectConstructions.length===0 || selectConstructions.length >1"  ></button>
          <button class="save"  pButton   (click)="showAddEquementMask()" label="选择设备"  ></button>
          <button  class="save" pButton   (click)="showAdd()" label="添加设备" ></button>
        </div>

      </div>
    </div>
    <label><span></span>设备列表</label>
    <p-dataTable [value]="devices" (onLazyLoad)="loadCarsLazy($event)" [lazy]="true" [rows]="10" [paginator]="true"
                 [totalRecords]="totalRecords"  [(selection)]="selectConstructions" [editable]="true"   [rowsPerPageOptions]="[5,10,20]">
      <p-column [style]="{'width':'38px'}" selectionMode="multiple"></p-column>
      <p-column  field="ano" header="设备编号" [sortable]="true" >
        <ng-template let-data="rowData" pTemplate="body" let-i="rowIndex">
          <span (click)="viewOption(data)" class="curser">{{data.ano}}</span>
        </ng-template>
      </p-column>
      <p-column  *ngFor="let col of cols" field="{{col.field}}" header="{{col.header}}" [editable]="col.editable"></p-column>
      <p-column  field="data" header="上架位置" [sortable]="true" >
        <ng-template let-data="rowData" pTemplate="body" let-i="rowIndex">
          <span>{{data['timeGroup']}}</span>
        </ng-template>
      </p-column>
      <p-column header="操作">
        <ng-template let-car="rowData" pTemplate="body" let-i="rowIndex">
          <button  pButton type="button"  label="编辑"  (click)="updateOption(editdataSource[i],'update',i)"></button>
        </ng-template>
      </p-column>
      <ng-template pTemplate="emptymessage" >
        当前没有数据
      </ng-template>
    </p-dataTable>
  </form>
</div>
<app-personal-dialog
  *ngIf="displayPersonel"
  (dataEmitter)="dataEmitter($event)"
  (displayEmitter)="displayEmitter($event)">
</app-personal-dialog>
<app-shelf-add-equipment
  *ngIf="showAddEquement"
  (closeEquement)="closeAddEquementMask($event)"
  (addDev)="addDev($event)"
></app-shelf-add-equipment>
<app-shelf-add-or-update-devices
  *ngIf="showAddMask"
  [state]="state"
  (closeAddMask)="removeMask($event)"
  [currentAsset]="tempAsset"
  (addDev)="addDevice($event)"
  (updateDev)="updateShelf($event)"
>
</app-shelf-add-or-update-devices>

<app-shelf-location
  *ngIf="displayLocation"
  (closeLocation)="closeAddLocationMask($event)"
  (addTree)="addConstructionOrg($event)"
></app-shelf-location>
<app-asset-detail
  *ngIf="showViewDetailMask"
  [currentAsset]="tempAsset"
  (closeDetailMask)="closeViewDetail($event)">
  ></app-asset-detail>
